﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace WillTheySplitTheCheck
{
    /// <summary>
    /// Contains code that controls submission of suggested database additions.
    /// </summary>
    public partial class AddRestaurant : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// Takes in user data for a suggested addition to the database and saves it in the Application State for later review.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if(Application["suggestions"] == null)
            {
                Application["suggestion"] = "";
            }

            Application["suggestion"] = (String) Application["suggestion"] + 
                NameSubmitTextBox.Text + "\n" + 
                AddressSubmitTextBox.Text + "\n" + 
                CitySubmitTextBox.Text + ", " + StateSubmitTextBox.Text + " " + ZipSubmitTextBox.Text + "\n";

            NameSubmitTextBox.Text = "";
            AddressSubmitTextBox.Text = "";
            CitySubmitTextBox.Text = "";
            StateSubmitTextBox.Text = "";
            ZipSubmitTextBox.Text = "";

            ThanksSubmitLabel.Visible = true;
        }
    }
}